#!/usr/bin/env bash
# 安装 kuberneter 相关
## 1. 设置yum源
cat > /etc/yum.repos.d/kubernetes.repo <<EOF
[kubernetes]
name=Kubernetes
baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

## 2. 安装k8s 注意安装的版本，根据需要更新
# 查看版本
#yum list|grep kube
yum -y install kubeadm-1.26.0 kubectl-1.26.0 kubelet-1.26.0

## 3. 启动k8s
systemctl enable kubelet
systemctl start kubelet